package primary.math;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author Elephas
 * @Date 2022/1/9
 **/
public class FizzBuzz {
    public List<String> fizzBuzz(int n){
        String[] ans = new String[n+1];
        for (int i = 1; i <= n; i++) {
            ans[i] = new Integer(i).toString();
        }
        for (int i = 0; i <= n; i+=3) {
            ans[i] = "Fizz";
        }
        for (int i = 0; i <= n; i+=5) {
            ans[i] = "Buzz";
        }
        for (int i = 0; i <= n; i+=15) {
            ans[i] = "FizzBuzz";
        }
        List<String > result = new ArrayList();
        for (int i = 1; i <= n; i++) {
            result.add(ans[i]);
        }
        return result;
    }
}
